package com.itheima;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入对称字符串:");
        String s = sc.nextLine();
        //将字符串封装为StringBuilder对象,目的是为了调用其反转的方法
        StringBuilder sb = new StringBuilder();
        sb.reverse();
        String reverseStr = sb.toString();

        //s : String
        //sb : StringBuilder
        //使用反转后的字符串和元字符串进行对比
        if(s.equals(reverseStr)){
            System.out.println("是堆成字符串");
        }else{
            System.out.println("不是对称字符串");
        }
    }

}
